#import "SoundDelegate.h"

@implementation SoundDelegate {
    
}
-(instancetype)init {
    self=[super init];
    self.player=[[AVAudioPlayer alloc]init];
    return self;
}

-(void) playSoundWithName:(NSString *)soundName andType:(NSString *)soundType{
    NSURL* sound;
    sound=[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:soundName ofType:soundType]];
    
    NSError *err;
    self.player =[[AVAudioPlayer alloc]initWithContentsOfURL:sound error:&err];
    NSLog(@"%@", err);
    self.player.delegate=self;
    [self.player play];
}
@end
